package com.zw.cloud.mybatis.plus.controller.stenter;


import com.zw.cloud.global.response.wrapper.entity.WebResult;
import com.zw.cloud.mybatis.plus.entity.stenter.BaseShapingParamConfig;
import com.zw.cloud.mybatis.plus.service.api.stenter.IBaseShapingParamConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 参数配置表 前端控制器
 * </p>
 *
 * @author zw
 * @since 2023-12-04
 */
@RestController
@RequestMapping("/base-shaping-param-config")
public class BaseShapingParamConfigController {

    @Autowired
    IBaseShapingParamConfigService baseShapingParamConfigService;

    @GetMapping("/initSort/{type}")
    //http://localhost:8082/base-shaping-param-config/initSort/13
    public void initSort(@PathVariable int type) {
        baseShapingParamConfigService.initSort(type);
    }

    @GetMapping("/getInitSortSql/{type}")
    //http://localhost:8082/base-shaping-param-config/getInitSortSql/13
    public WebResult<String> getInitSortSql(@PathVariable int type) {
        return WebResult.success(baseShapingParamConfigService.getInitSortSql(type));
    }

    /**
     * 定前布车号、定后布车号、上机门幅、落机门幅、定后克重、实际数量、助剂填写、定前克重，默认“是”；
     * 历史工厂 将上述字段 status 设置为1，其他字段取值为  对应工艺参数是否启用
     */
    @GetMapping("/updateStatusByOtherType")
    //http://localhost:8082/base-shaping-param-config/updateStatusByOtherType
    public void updateStatusByOtherType() {
        baseShapingParamConfigService.updateStatusByOtherType();
    }

    @GetMapping("/queryListByType/{type}")
    //http://localhost:8082/base-shaping-param-config/queryListByType/13
    public WebResult<List<BaseShapingParamConfig>> queryListByType(@PathVariable int type) {
        return WebResult.success(baseShapingParamConfigService.queryListByType(type));
    }
}
